-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[16.0][MIG]: web_edit_user_filter: Migration to 16.0 #3007
base: 16.0
Are you sure you want to change the base?
Conversation
[FIX] Readme [FIX] Lint [ADD] Tests [IMP] UI/UX [IMP] Hide popover when other is opened [IMP] Add item to roadmap
Added translation using Weblate (Chinese (Simplified)) Translated using Weblate (Chinese (Simplified)) Currently translated at 100.0% (3 of 3 strings) Translation: web-12.0/web-12.0-web_edit_user_filter Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_edit_user_filter/zh_CN/ Added translation using Weblate (Croatian) Translated using Weblate (Croatian) Currently translated at 66.7% (2 of 3 strings) Translation: web-12.0/web-12.0-web_edit_user_filter Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_edit_user_filter/hr/ Added translation using Weblate (Portuguese) Translated using Weblate (Portuguese) Currently translated at 100.0% (3 of 3 strings) Translation: web-12.0/web-12.0-web_edit_user_filter Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_edit_user_filter/pt/
has to explicit check for type of value !== null as the typeof null is object https://i.stack.imgur.com/FzI1R.png
Added translation using Weblate (Danish) Translated using Weblate (Danish) Currently translated at 100.0% (3 of 3 strings) Translation: web-12.0/web-12.0-web_edit_user_filter Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_edit_user_filter/da/
Added translation using Weblate (Spanish) Translated using Weblate (Spanish) Currently translated at 100.0% (3 of 3 strings) Translation: web-12.0/web-12.0-web_edit_user_filter Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_edit_user_filter/es/ Added translation using Weblate (French) Translated using Weblate (French) Currently translated at 100.0% (3 of 3 strings) Translation: web-12.0/web-12.0-web_edit_user_filter Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_edit_user_filter/fr/ Added translation using Weblate (Catalan) Translated using Weblate (Catalan) Currently translated at 100.0% (3 of 3 strings) Translation: web-12.0/web-12.0-web_edit_user_filter Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_edit_user_filter/ca/
Added translation using Weblate (Portuguese (Brazil)) Translated using Weblate (Portuguese (Brazil)) Currently translated at 100.0% (3 of 3 strings) Translation: web-12.0/web-12.0-web_edit_user_filter Translate-URL: https://translation.odoo-community.org/projects/web-12-0/web-12-0-web_edit_user_filter/pt_BR/
When clicking to edit a filter in search view, the _process_filters function will receive the faceID argument as a string, which will be compared to facet.groupId that is an Integer. Therefore we should use == operator when comparing this value to allow type coercion from JS.
bb1ccf2
to
8643376
Compare
Verified Scenarios:
Unverified Scenarios:
|
for i, res_filter in enumerate(res): | ||
# Add the field 'facet' to the result | ||
res[i]["facet"] = filters.filtered(lambda f: f.id == res_filter["id"]).facet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion:
for i, res_filter in enumerate(res): | |
# Add the field 'facet' to the result | |
res[i]["facet"] = filters.filtered(lambda f: f.id == res_filter["id"]).facet | |
for res_filter in res: | |
# Add the field 'facet' to the result | |
res_filter["facet"] = filters.filtered(lambda f: f.id == res_filter["id"]).facet |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
web_edit_user_filter/__manifest__.py
Outdated
"web_edit_user_filter/static/src/xml/backend.xml", | ||
"web_edit_user_filter/static/src/xml/search_extended.xml", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chore: for consistence,
"web_edit_user_filter/static/src/xml/backend.xml", | |
"web_edit_user_filter/static/src/xml/search_extended.xml", | |
"web_edit_user_filter/static/src/xml/*.xml", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
var searchItems = this.env.searchModel.getSearchItems( | ||
(s) => s.type === "favorite" | ||
); | ||
const favorites = searchItems.filter( | ||
(f) => f.description === this.state.description | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion:
var searchItems = this.env.searchModel.getSearchItems( | |
(s) => s.type === "favorite" | |
); | |
const favorites = searchItems.filter( | |
(f) => f.description === this.state.description | |
); | |
var searchItems = this.env.searchModel.getSearchItems( | |
(s) => s.type === "favorite" && s.description === this.state.description | |
); |
(there are a few similar simplifications that could be made around the code)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modified as suggested. Identified in few other places and modified it. However, could not modify in places like here and popover is not visible when modifying it.
From testing on v14, In fact, in v14, contacts view:
I'd even go as far as suggesting removing that code path entirely, and adding to the Roadmap that the module is not currently compatible with custom filters. I don't think it's within the scope of the migration to fix that problem, necessarily. Though of course the last word is up to a maintainer. |
8643376
to
f01d632
Compare
Tried to use custom groups and filters as mentioned and it works in v16 and it is able to unpack the filters/groupBy which are selected from Add custom filter/group For eg: (Both "Application" and "Created By" custom groups under App module)
However, for this case as well it did not go inside tentative filter related branch code, so removed for now from the PR. In order to include as part of ROADMAP, I am not sure what to be mentioned as above custom related filters/groupBy works in v16(though it does not work in v14). As part of latest patchset, corrected issue with displaying facet values and unpacking facets that related to type "field". |
I had not tested on v16, if it works correctly then great, no need to mention anything on the roadmap. Thank you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code review, LGTM, just some minor non-blocking code cleanup possible
var currentFacet = this.env.searchModel.getSearchItems( | ||
(f) => f.type === facet_type && f.groupId == facetId | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment (non-blocking): I think in this case using searchItems.filter
was better, because you're filtering a subset of the searchItems
you had already filtered beforehand, instead of searching from every filter in the model.
On the other hand, if searchItems
is already filtered by facet_type
and you use .filter
here, you can drop the f.type === facet_type
condition because it was already checked earlier.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated as suggested
f01d632
to
9b842b6
Compare
Identified an item for ROADMAP and included it on the ROADMAP file. |
Migrating web_edit_user_filter to 16.0